/* eslint-disable */
'use strict';

module.exports = app => {
    const { STRING, ENUM, TEXT, BIGINT, DATE } = app.Sequelize;

    const Feedback = app.model.define('feedback', {
        id: { type: BIGINT, primaryKey: true, autoIncrement: true },  
        user_id: { type: BIGINT, allowNull: false },  
        content: { type: TEXT, allowNull: false },   
        type: {
            type: ENUM('suggestion', 'complaint', 'bug', 'other'),  
            allowNull: false,
        },
        status: {
            type: ENUM('pending', 'resolved'),  
            allowNull: false,
            defaultValue: 'pending',
        },
        created_at: DATE, 
        updated_at: DATE,   
    }, {
        tableName: 't_feedback',  
    });

    Feedback.associate = function () {
        app.model.Feedback.belongsTo(app.model.User, {
            foreignKey: 'user_id',
            as: 'user',  
        });
    };

    return Feedback;
};